﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;

namespace StreetlightGames.XnaEngine
{
    public class AudioController
    {
        private AudioEngine _audioEngine;
        private SoundBank _soundBank;
        private WaveBank _waveBank;

        /// <summary>Gets the Instance value</summary>
        public static AudioController Instance
        {
            get
            {
                if (_instance == null)
                {
                    _instance = new AudioController();
                }
                return _instance;
            }
        }
        private static AudioController _instance;

        public AudioController()
        {
        }

        public void LoadContent(string settingsFile, string waveBankFile, string soundBankFile)
        {
            _audioEngine = new AudioEngine(settingsFile);
            _waveBank = new WaveBank(_audioEngine, waveBankFile);
            _soundBank = new SoundBank(_audioEngine, soundBankFile);
        }

        public Cue GetCue(string cueName)
        {
            return _soundBank.GetCue(cueName);
        }

        public void Update()
        {
            _audioEngine.Update();
        }

        public void PlayCue(string cueName)
        {
            _soundBank.PlayCue(cueName);
        }
    }
}
